module ExtHeaders where
import Network.HTTP
import Data.List

--headers str = map headerToTuple $ takeWhile (/= "") (lines str)
headers str = putStrLn $ show $ head str

headerToTupAux char string = case elemIndex char string of
                                Just n -> n
                                Nothing -> length string

headerToTuple string = if snd tup == []
                      then (fst tup, "'()'")
                      else (fst tup, drop 1 (snd tup))
                    where tup = splitAt (headerToTupAux ':' string) string
